<script setup>
import { useRoute,useRouter } from 'vue-router';
import { queryReturnVisitRecord  } from '@/api/Member/index.js'
import { ElMessage,ElMessageBox  } from 'element-plus';
const props = defineProps({
    uuid:{
        default:"",
        type:[String,Number]
    }
})

const recordList = ref([]);
const pageLoading = ref(false);
const _queryReturnVisitRecord = async ()=>{
    try{
        pageLoading.value = true;
        let params = {
            storeId: "",
            orderBy: "",
            rule:"",
            page: {
                size: 99999,
                current: 1
            },
            memberId:props.uuid,
            enterpriseId: ""
        }
        let result = await queryReturnVisitRecord(params);
        recordList.value =  result.records.map(lis=>{
            let returnVisitTime = lis.returnVisitTime?lis.returnVisitTime.split("-"):[];
            return {
                ...lis,
                monthAndDay:returnVisitTime[1] && returnVisitTime[2]?returnVisitTime[1]+'/'+returnVisitTime[2]:"-",
                year:returnVisitTime[0]
            }
        })

    }catch(e){
        console.log(e);
    }finally{
        pageLoading.value = false;
    }
}
_queryReturnVisitRecord();
</script>
<template>
    <div class="record-area" v-loading="pageLoading">
        <template v-if="recordList.length>0">
            
        
            <div class="record-lis" v-for="(item,index) in recordList" :key="index">
                <div class="date">
                    <div class="p1">
                        {{ item.monthAndDay }}
                    </div>
                    <div class="p2">
                        {{ item.year }}
                    </div>
                </div>
                <div class="chat-info">
                    <div class="store-info">
                        <img src="@/assets/icon/store-name.png" alt="" class="img1">
                        <div class="name-info">
                            {{ item.storeName || '-' }}
                        </div>
                        <div class="person">
                            <img src="@/assets/icon/blue-p.png" alt="" class="img2">
                            <span>{{ item.enterpriseUserName || '-' }}</span>
                        </div>
                    </div>
                    <div class="speak-block">
                        <div class="lis-speak">
                            <div class="speak-p">
                                回访内容：
                            </div>
                            <div class="speak-i">
                                {{ item.returnVisitContent || '-' }}
                            </div>
                        </div>
                        <div class="lis-speak">
                            <div class="speak-p">
                                客户回复：
                            </div>
                            <div class="speak-i">
                                {{ item.customerReply || '-' }}
                            </div>
                        </div>
                    </div>
                </div>
                <div class="img-show">
                    <div class="img-b" v-if="item.customerReplyImg && item.customerReplyImg.length>0">
                        <div class="mask" style="pointer-events: none;" v-if="item.customerReplyImg.length>1">
                            +{{ item.customerReplyImg.length }}
                        </div>
                        <div style="position:relative">
                            <div class="img2" >
                                <el-image
                                    :src="item.customerReplyImg[0]"
                                    :zoom-rate="1.2"
                                    :preview-src-list="item.customerReplyImg"

                                    style="width:100px;height:100px"
                                />
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </template>
        <div class="empty-data" v-else>
            <div class="empty-img">
                <div class="text">暂无回访记录</div>
            </div>
        </div>
    </div>
</template>
<style lang="less" scoped>
.empty-data{
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    .empty-img{
        width: 300px;
        height: 200px;
        background: url('@/assets/images/empty-table.png');
        background-size: 100% 100%;
        position: relative;
        .text{
            position: absolute;
            bottom:0;
            width: 100%;
            text-align: center;
            color: #666666;
            line-height: 14px;
            font-size: 14px;

        }
    }
}
.record-area{
    width: 100%;
    min-height: 40%;
    .record-lis{
        width: 100%;
        display: flex;
        justify-content: flex-start;
        margin-bottom:16px;
        background: #f6f6f6;
        padding:16px 0;
        border-radius: 4px;
        .person{
            display: flex;
            justify-content: flex;
            border-radius: 4px;
            background: rgba(52, 128, 255, 0.1);
            padding: 7px 8px;
            color: #3480ff;
            font-size: 14px;
            line-height: 14px;
            .img2{
                width: 14px;
                height: 14px;
                margin-right: 4px;
            }
        }
        .person2{
            display: flex;
            justify-content: flex;
            border-radius: 4px;
            background: rgba(232, 249, 239, 1);
            padding: 7px 8px;
            color: #18BF5B;
            font-size: 14px;
            line-height: 14px;
            .img2{
                width: 14px;
                height: 14px;
                margin-right: 4px;
            }
        }
        .date{
            width: 90px;
            box-sizing: border-box;
            padding:12px;
            padding-right: 0px;
            .p1{
                color: #000000;
                width:100%;
                font-size: 24px;
                font-weight: bold;
                line-height: 24px;
            }
            .p2{
                color: #000000;
                width:100%;
                font-size: 16px;
                font-weight: bold;
                line-height: 16px;
                margin-top:8px;
            }
        }
        .img-show{
            box-sizing:border-box;
            padding:16px;
            padding-top:0px;
            .person-lis{
                width: 100%;
                margin-bottom:8px;
                display: flex;
                justify-content: flex-start;

            }
            .img-b{
                position: relative;
                width: 100px;
                height: 100px;
                .img1{
                    width: 100%;
                    height: 100%;
                    border-radius: 4px;
                    position: absolute;
                    top:0;
                    left:0;
                    z-index: 1;
                }
                .mask{
                    width: 100%;
                    height: 100%;
                    border-radius: 4px;
                    background: rgba(0, 0, 0, 0.4);   
                    top:0;
                    left:0;
                    position: absolute;
                    z-index: 2;
                    display: flex;
                    justify-content: center;
                    align-items: center;
                    font-size: 20px;
                    color:#fff;
                    font-weight: bold;
                }
                .img2{
                    width: 100%;
                    height: 100%;
                    border-radius: 4px;


                }
            }
        }
        .chat-info{
            padding:0 16px;
            box-sizing: border-box;
            border-left:1px solid #DDDDDD;
            border-right:1px solid #DDDDDD;
            .store-info{
                width: 100%;
                display: flex;
                justify-content: flex-start;
                padding-top:5px;
                padding-bottom:8px;
                align-items:center;
                .img1{
                    width: 18px;
                    height: 18px;
                }
                .name-info{
                    margin-left:4px;
                    margin-right:16px;
                    color:#000;
                    font-weight:bold;
                    line-height: 18px;
                    font-size: 18px;
                }
                .name-info2{
                    color:#222222;
                    font-size: 14px;
                    line-height: 14px;
                }
                .s-line{
                    width: 1px;
                    height: 48px;
                    background:#DDDDDD;
                    margin-right: 16px;
                }

            }
            .icon-info{
                width: 100%;
                display: flex;
                justify-content: flex-start;
                flex-wrap: wrap;

                .icon-lis{
                    margin-bottom:16px;
                    width: 50%;
                    display: flex;
                    justify-content: flex-start;
                    align-items: center;
                    .icon-1{
                        width: 14px;
                        height: 14px;
                    }
                    .l-name{
                        color: #222222;
                        font-size: 14px;
                        margin-left:4px;
                        margin-right: 16px;

                    }
                    .r-name{
                        color: #FF6B00;
                        font-size: 14px;
                        margin-left:4px;
                        margin-right: 16px;
                    }
                }
            }
            .speak-block{
                width: 720px;
                padding: 12px;
                box-sizing: border-box;
                background: #fff;
                border-radius: 4px;
                .lis-speak{
                    width: 100%;
                    display: flex;
                    justify-content: flex-start;
                    margin-bottom:16px;
                    &:last-child{
                        margin-bottom: 0;
                    }
                    .speak-p{
                        width: 70px;
                        color: #000000;
                        font-size: 14px;
                        font-weight: bold;
                        line-height: 14px;
                    }
                    .speak-i{
                        width: calc(100% - 70px);
                        color: #222222;
                        font-size: 14px;
                        line-height: 14px;
                        word-break: break-all;
                        word-wrap: break-word;
                    }
                }
            }
        }
    }
}
</style>